Developer Documentation

QuickTime 4 API Documentation

Inside Macintosh: Macintosh Toolbox Essentials

Previous | Chapter Top | Chapter Contents | Next |

Filter Function for Searching the High-Level Event Queue

This section describes the filter function that you can provide to GetSpecificHighLevelEvent . For example, you might use a filter function to search for a high-level event sent from a specific application.

MyFilter

When you use GetSpecificHighLevelEvent (GetSpecificHighLevelEvent) to search the high-level event queue of your application for a specific event, you supply a pointer to a filter function. GetSpecificHighLevelEvent calls your filter function once for each event in the high-level event queue until your filter function returns true or the end of the queue is reached. Your filter function can examine each event and determine whether that event is the desired event. If so, your filter function should return true .

Here's how you declare the filter function MyFilter :

pascal Boolean MyFilter (void *contextPtr,
                                         HighLevelEventMsgPtr msgBuff,
                                         const TargetID *sender);
contextPtr
The address of data that specifies the criteria your filter function should use to select a specific event. For example, you can specify in the contextPtr parameter the address of a reference constant to search for a particular event, the address of a target ID structure to search for a specific sender of an event, or the address of an event class to search for a specific class of event.
msgBuff
A pointer to a structure of type HighLevelEventMsg , which provides: the event record for the high-level event and the reference constant of the event. The HighLevelEventMsg data type is described in "The High-Level Event Message Structure" .
sender
The address of the target ID structure of the application that sent the event. The target ID structure is described in "The Target ID Structure" .

DESCRIPTION

Your filter function can compare the contents of the contextPtr parameter with the contents of the msgBuff and sender parameters. If your filter function finds a match, it can call AcceptHighLevelEvent , if necessary, and your filter function should return true . If your filter function does not find a match, it should return false .

SEE ALSO

For information about getting a routine descriptor for your filter function, see "Filter Function Pointer and Macro" .


© 1997 Apple Computer, Inc.

Previous | Chapter Top | Chapter Contents | Next